﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Linq.Expressions;

namespace CoreEx.Database.Linq
{
    /// <summary>
    /// Represents a class that is capable of extracting a set of <see cref="IRelationLoadTarget"/> instances
    /// from an expression that contains a <see cref="Queryable"/> instance implementing <see cref="ILoadOptions"/>.
    /// </summary>
    public interface IRelationLoadTargetExtractor
    {
        /// <summary>
        /// Extracts the load expressions from a <see cref="Queryable"/> instance        
        /// </summary>
        /// <param name="expression">The target expression.</param>
        /// <returns>An <see cref="IDictionary{TKey,TValue}"/> that 
        /// contains a list of <see cref="IRelationLoadTarget"/> instances per target <see cref="Type"/>.</returns>
        IDictionary<Type, IList<IRelationLoadTarget>> ExtractFrom(Expression expression);
    }
}
